<?php
	session_start();
	require 'include/configDB.php';
?>
<!DOCTYPE html
 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Input Jadwal Pelajaran</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ddaccordion.js"></script>
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})
</script>

<script type="text/javascript" src="jconfirmaction.jquery.js"></script>
<script type="text/javascript">
	
	function validasi(){

		if (document.input_jadwal.hari.value == "") {
			alert("Hari harus diisi!");
			return false;
		}

		if (document.input_jadwal.id_matpel.value == "") {
			alert("Mata Pelajaran harus diisi!");
			return false;
		}

		if (document.input_jadwal.id_guru.value == "") {
			alert("Guru harus diisi!");
			return false;
		}

		if (document.input_jadwal.waktu_mulai.value == "") {
			alert("Waktu mulai harus diisi");
			return false;
		}

		if (document.input_jadwal.waktu_selesai.value == "") {
			alert("Waktu akhir harus diisi");
			return false;
		}
	}
	
</script>

<script language="javascript" type="text/javascript" src="niceforms.js"></script>
<link rel="stylesheet" type="text/css" media="all" href="niceforms-default.css" />
<style>
	<?php include 'include_style.php'; ?>
</style>
</head>
<body>
<div id="main_container">

	<?php include 'header.php'; ?>
    
    <div class="main_content">
                
                    
    <div class="center_content">  
		
    
	
    <div class="left_content">
    
    		<?php include 'left_content.php'; ?>
    		<?php include 'calendar.php' ; ?>
    </div>  
    
    <div class="right_content">
	<h2>Input Jadwal Pelajaran</h2>
		<div id="stylized" class="myform">
			<form id="input_jadwal" name="input_jadwal" method="post" action="include/input_jadwal_pelajaran.php" onsubmit='return validasi();'>
			<h1>Jadwal Pelajaran</h1>
			<table>
				<tr>
					<?php
						$query = mysql_query("SELECT * FROM tahun_ajaran WHERE id=" . $_POST['tahun_ajaran']);
						$tahun_ajaran_data = mysql_fetch_assoc($query);
					?>
					<td>
						<label>Tahun Ajaran
							 <span class="small">Tahun Ajaran</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<input readonly type="text" name="tahun_ajaran" id="tahun_ajaran" value="<?php echo $tahun_ajaran_data['tahun_ajaran']?>"/>
						<input type="hidden" name="id_tahun_ajaran" id="id_tahun_ajaran" value="<?php echo $tahun_ajaran_data['id']; ?>" />
					</td>
				</tr>
				<tr>
					<td>
						<label>Hari
							 <span class="small">isi hari</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<select name="hari" id="hari">
							<option value="">---------Pilih----------</option>
							<option value="senin">Senin</option>
							<option value="selasa">Selasa</option>
							<option value="rabu">Rabu</option>
							<option value="kamis">Kamis</option>
							<option value="jumat">Jumat</option>
							<option value="sabtu">Sabtu</option>

						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label>kelas
							<span class="small">isi kelas</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						 <input readonly type="text" name="tingkat" id="tingkat" value="<?php echo $_POST['tingkat']; ?>" />
					</td>
				</tr>
				<tr>
					<td>
						<label>Jurusan
							 <span class="small">isi nama jurusan</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<?php
						$query = mysql_query("SELECT * FROM jurusan WHERE id=" . $_POST['jurusan']);
						$jurusan = mysql_fetch_assoc($query);
						?>
						 <input readonly type="text" name="nama_jurusan" id="nama_jurusan" value="<?php echo $jurusan['nama']; ?>" />
						 <input type="hidden" name="id_jurusan" id="id_jurusan" value="<?php echo $jurusan['id']; ?>" />
					</td>
				</tr>
				<tr>
					<td>
						<label>No Kelas
							 <span class="small">isi nomor kelas</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						 <input readonly type="text" name="no_kelas" id="no_kelas" value="<?php echo $_POST['no_kelas']; ?>" />
					</td>
				</tr>
				<tr>
					<td>
						<label>Mata Pelajaran
							 <span class="small">isi mata pelajaran</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<select name= "id_matpel" id="id_matpel">
							<option value="">---------Pilih----------</option>
							<?php 
						        $nama_matpel = mysql_query("SELECT * FROM mata_pelajaran");  
								// $result = mysql_fetch_array($nama_jurusan);
						        while($matpel_data = mysql_fetch_array($nama_matpel))
						        {
						   		?>  
        							<option value="<?= $matpel_data['id']; ?>"><?= $matpel_data['nama']?></option>  
								<?php  
								}  
							?>  	
						</select>
					</td>
				</tr>
				<tr>
					<td>
						<label>ID Guru
							 <span class="small">isi ID guru</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						 <select name="id_guru" id="id_guru">
						 	<option value="">---------Pilih----------</option>
							<?php 
						        $nama_guru = mysql_query("SELECT * FROM guru");  
						        
						        while($guru_data = mysql_fetch_array($nama_guru))
						        {
						   		?>  
        							<option value="<?= $guru_data[0]; ?>"><?= $guru_data['nama']?></option>-->  
								<?php  
								}  
							?>  	
						</select>
					</td>
				</tr>    

				
				<tr>
					<td>
						<label>Waktu Mulai
							 <span class="small">isi ID waktu mulai</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<select name="waktu_mulai" id="waktu_mulai">
							<option value="">---------Pilih----------</option>
							<option value="7.00">Jam ke - 1</option>
							<option value="7.40">Jam ke - 2</option>
							<option value="8.20">Jam ke - 3</option>
							<option value="9.00">Jam ke - 4</option>
							<option value="9.40">Jam ke - 5</option>
							<option value="10.00">Jam ke - 6</option>
							<option value="10.40">Jam ke - 7</option>
							<option value="11.20">Jam ke - 8</option>
							<option value="12.00">Jam ke - 9</option>
							<option value="12.40">Jam ke - 10</option>
						</select>
					</td>
				</tr>
				
				<tr>
					<td>
						<label>Waktu Selesai
							 <span class="small">isi waktu akhir</span>
						</label>
					</td>
					<td>
						:
					</td>
					<td>
						<select name="waktu_selesai" id="waktu_selesai">
							<option value="">---------Pilih----------</option>
							<option value="7.00">Jam ke - 1</option>
							<option value="7.40">Jam ke - 2</option>
							<option value="8.20">Jam ke - 3</option>
							<option value="9.00">Jam ke - 4</option>
							<option value="9.40">Jam ke - 5</option>
							<option value="10.00">Jam ke - 6</option>
							<option value="10.40">Jam ke - 7</option>
							<option value="11.20">Jam ke - 8</option>
							<option value="12.00">Jam ke - 9</option>
							<option value="12.40">Jam ke - 10</option>
						</select>
					</td>
				</tr>
				<tr>
					<td><input type="submit" name="submit" class="menuitem_red" value="Tambah"/></td>
				</tr>
			</table>
			</form>
		</div>
	</div><!-- end of right content-->
	
            
                    
	</div>   <!--end of center content -->               
                    
                    
    
    
    <div class="clear"></div>
    </div> <!--end of main content-->
	
    
    <div class="footer">
        	<?php include 'footer.php'; ?>

    	
    </div>

</div>		
</body>
</html>